#!/bin/bash

# Function to convert timestamp to a readable date
convert_timestamp() {
    date -d @"$1" +"%Y-%m-%d %T"
}

# Read log entries from standard input
while IFS= read -r line; do
    echo "$line" | awk -F'[{}:,"]+' '
    {
        for(i=2; i<=NF; i+=2) {
            key=$i
            value=$(i+1)
            if (key == "ts") {
                cmd="date -d @" value " \"+%Y-%m-%d %T\""
                cmd | getline value
                close(cmd)
            }
            printf "%s ", value
        }
        print ""
    }'
done